<?php

/*
 * Create by Indonesian Brain Solutions
 * E-mail : cs@mesinit.com
 * Programmer : sony@sonywibisono.com
 */
if (!defined('__BACKEND__'))
    die("you cannot directly access this page");

include("class/AppMenus.php");

_showMenuHeader();

function add(){
    echo "<h2>Add Record</h2>";
}
function edit(){
    global $db,$id;
    if(!empty($id)){
    $sql="select * from";
    $row=$db->fetch_row($sql);
    extract($row);
    echo "<h2>Edit Record</h2>";
    }
}
function add_process(){
    global $db,$id,$mod,$file;
    if (!empty($caption)){
    //echo "Add Process Record";
    $app_menus=new AppMenus($id,$caption,$tool_tips,$grant_admin,$enabled,$icon_url,$filename,$module_id);
    $app_menus->insert();
    $url="?mod=$mod&file=$file";
    $msg="Add New Record Success";
    refresh_to($url, $msg, 2);
    }
}
function edit_process(){
    global $db,$id,$mod,$file;
    if (!empty($caption)){
    //echo "Add Process Record";
    $app_menus=new AppMenus($id,$caption,$tool_tips,$grant_admin,$enabled,$icon_url,$filename,$module_id);
    $app_menus->update();
    $url="?mod=$mod&file=$file";
    $msg="Update Record Success";
    refresh_to($url, $msg, 2);
    }
}
function delete_process(){
    global $db,$id,$mod,$file;
    if (!empty($id)){
    echo "Delete Process Record";
    $url="?mod=$mod&file=$file";
    $msg="Delete Record Success";
    $sql="delete from app_menus where id=$id";
    $db->query($sql);
    refresh_to($url, $msg, 2);
    }
}
function __default(){
    global $db,$page,$sortby,$sortorder,$mod,$pagesize,$file;
    ?>
<h1>Welcome to Online Helpdesk Management System</h1>
<?php
}
global $action,$user_id,$login_status,$is_admin,$mod;
switch($action){
    case 'add':
        add();
        break;
    case 'edit':
        edit();
        break;
    case 'add_process':
        add_process();
        break;
    case 'edit_process':
        edit_process();
        break;
    case 'delete':
        delete_process();
        break;
    default:
        __default();
}
?>